package com.example.app.moudle.home.vm

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LifecycleOwner
import com.example.app.moudle.home.event.EventHomeLoadMore
import com.example.app.moudle.home.event.EventHomeRefresh
import com.libcommon.LiveEventManager

/**
 * Created on 2022/9/13.
 * @author Joker
 * Des:数据中心
 */

object HomeVM{


    /**
     * 请求数据处理
     */
    fun getHomeList(owner: LifecycleOwner, pageType: Int, isRefresh: Boolean) {
//        HttpManager.postBody(owner, HttpURL.URL_EMAIL_LOGIN, mutableMapOf("1" to 2), object : RequestCallBack<SimpleReqEntity?> {
//            override fun onSuccess(data: SimpleReqEntity?) {
//            }
//
//            override fun onFail(code: Int, msg: String?) {
//            }
//        })


        val list = mutableListOf<String>()
        for (i in 0..50) {
            list.add("https://img0.baidu.com/it/u=1390194907,1388277708&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500")
        }

        LiveEventManager.post(
            if (isRefresh) EventHomeRefresh(list, true, pageType) else EventHomeLoadMore(list, true, pageType)
        )
    }


}